;(function($) {

    $(function () {
        var $userTabUl = $('.mbshop_userCenterListTabList ul')
        var $userTabList = $('.mbshop_userCenterListTabList ul li')
        $userTabUl.on("click", "li", function(e) {
            $(this).siblings().removeClass("mbshop_userCenterListTabOn").end().addClass("mbshop_userCenterListTabOn")
            var index = $(this).index()
            $(".mbshop_userCenterListTabBox .mbshop_userCenterConFrame").eq(index).show().siblings(".mbshop_userCenterConFrame").hide()
        })

    })
    $(function () {
        var $a = $('.mbshop_usLeft dd>a').not('.myShop')
        var $mbshopRight = $('.mbshop_usRight')        
        $a.on('click',function(){
            var index = $a.index(this)
            $a.removeClass('mbshop_userLeftItemOn')
            $(this).addClass('mbshop_userLeftItemOn').parent().siblings().children('a').removeClass("mbshop_userLeftItemOn")
            $mbshopRight.eq(index).show().siblings(".mbshop_usRight").hide()
        })
        
    })
    //省市区三级联动
    $(function () {
        $('#pro').ProvinceCity()         
    })
    //年月日
    $(function () {
        $.date_picker({
            YearSelector:  "#birthday_y",
            MonthSelector: "#birthday_m",
            DaySelector:   "#birthday_d"
        });
       
    })

    $(function () {
        $('#formModifyPwd').validate({          
            rules: {
                opassward: 'required',
                passward: {
                    required: true,
                    passward: true
                },
                repassword: {
                    required: true,
                    equalTo: '#formModifyPwd [name="passward"]'
                }
            },
            messages: {
                opassward: '请输入旧密码',
                passward: {
                    required: '请输入新密码',
                },
                repassword: {
                    required: '请再次输入密码'
                }
            }
        })
    })   
    $(function () {
        //新增记录显示表单
        $('.mbshop_btn_addSize').on('click', function () {
            $('#formSizeDataInfo')[0].reset();
            $('#editBlock').css("display", "block");
        })
        //保存记录隐藏表单
        $('#saveSizeData').on('click', function () {
            $("#updateSizeData").css('display', 'none');
            $("#saveSizeData").css('display', 'block');
            var formDataArr = $("#formSizeDataInfo").serializeArray();
            var html = "";
            html += "<td>" + $(".select2").val() + "</td>";
            html += "<td>" + formDataArr[1].value + "</td>";
            html += "<td>" + formDataArr[2].value + "</td>";
            html += "<td>" + formDataArr[3].value + "</td>";
            html += "<td>" + formDataArr[4].value + "</td>";
            html += "<td><a  name='edit' href='javascript:;'>修改</a> | ";
            html += "<a class='delete' href='javascript:;'>删除</a></td>";
            html = "<tr>" + html + "</tr>";                
            $("#roleDataInfo").append(html);
            $('#editBlock').css("display", "none");               
        })
        
    })     

    //生成验证码
    $(function () {
        $('.check-code').code_Obj({
            codeLength: 4
        });
        $('.check-code2').code_Obj({
            codeLength: 4
        });
        $('.check-code3').code_Obj({
            codeLength: 4
        });
        $('.check-code4').code_Obj({
            codeLength: 4
        });
    })
}(jQuery))